// main.js
import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入组件
import Nav from '../components/Nav.vue'
import Home from '../pages/Home.vue'

// 使用插件
Vue.use(VueRouter)

// 创建路由实例
const router = new VueRouter({
  mode: 'history',
  routes: [
    { path: '/', redirect: '/home' },
    {
      path: '/home', component: Nav, children: [
        { path: '/home', component: Home, name: '首页'},
        { path: '/selectCourse', component: () => import('../pages/SelectCourse.vue'), children: [],name: '选课中心' },
        { path: '/train', component: () => import('../pages/TrainPage.vue'), children: [], name: '企业培训'},
        { path: '/exam', component: () => import('../pages/ExamPage.vue'), children: [], name: '考试中心'},
      ]
    },
  ]
});

export default router